python store salt in csv

109

import os, base64

salt = os.urandom(64)

# convert to a base64 string:
s = base64.b64encode(storage).decode('utf-8')

print(s) # <-- string you can save this to a file

# after reading it back from a file convert back to bytes
the_bytes = base64.b64decode(s)

the_bytes == salt
# True

Comments

Submit
0 Comments